package com.kly.cashmall.module.home.home_tab.tab_view;

import android.text.TextUtils;

import com.kly.cashmall.module.home.home_tab.Route;
import com.kly.cashmall.module.index.IndexFragment;
import com.kly.cashmall.module.mine.AccountFragment;
import com.kly.cashmall.module.order.LoanTypeFragment;
import com.kly.cashmall.module.products.ProductsFragment;

import java.util.HashMap;

public class TagStaticMap {
  public static final String TAG_HOME = Route.APP_ACTION_SCHEME +Route.MODULE_ACTION_HOME;
  public static final String TAG_LOAN_PRODUCTS =  Route.APP_ACTION_SCHEME + Route.MODULE_ACTION_PRODUCT;
  public static final String TAG_LOAN_ORDERS =  Route.APP_ACTION_SCHEME  + Route.MODULE_ACTION_ORDER;
  public static final String TAG_MINE_CENTER = Route.APP_ACTION_SCHEME + Route.MODULE_ACTION_ACCOUNT;

  private static HashMap<Class, String> tagMap = new HashMap<>();

  static {
    tagMap.put(IndexFragment.class, TAG_HOME);
    tagMap.put(ProductsFragment.class, TAG_LOAN_PRODUCTS);
    tagMap.put(LoanTypeFragment.class, TAG_LOAN_ORDERS);
    tagMap.put(AccountFragment.class, TAG_MINE_CENTER);
  }

  public static String findTagName(Class key) {
    String tagName = tagMap.get(key);
    return TextUtils.isEmpty(tagName) ? key.getName() : tagName;
  }
}
